<?php
Class CentreDAO
{
	public $connexion;

	public function __construct()
	{
		try {
			$this->connexion = new PDO("mysql:host=".SERVEUR_MYSQL.";dbname=".BASE.";charset=utf8", UTILISATEUR, M2P);
		}
		catch(PDOException $e)
		{
			echo "Erreur : ".$e->getMessage();
			die();
		}
	}


	public function rechercher_centre_par_id($idcentre)
	{
		$query = "SELECT * "
		."FROM centre "
		."WHERE idcentre = :idcentre ";

		$requette_preparee = $this->connexion->prepare($query);
		$requette_preparee->bindValue(":idcentre" , $idcentre, PDO::PARAM_INT);
		$requette_preparee->execute();
		$centre = $requette_preparee->fetchObject('Centre');
		return  $centre;

	} // rechercher_centre_par_id

	public function rechercher_centre()
	{
		$query = "SELECT * "
		."FROM centre ";
		$requette_preparee = $this->connexion->prepare($query);
		$requette_preparee->execute();
		$centres= $requette_preparee->fetchAll(PDO::FETCH_CLASS,'Centre');
		return  $centres;

	} // rechercher_centre
	
	
	public function ajouter_centre($centre)
	{


	} // ajouter_centre

} // CentreDAO



?>
